package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.CourseBaseDTO;
import com.xuecheng.content.entity.CourseBase;
import com.xuecheng.content.service.CourseBaseService;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 课程基础信息转换器
 *  步骤：
 *      1.创建一个接口
 *      2.接口类上添加MaoStruct的标志注解
 *      3.在接口中通过相应的api创建出接口的转换器实现类
 *      4.编写转换的方法
 */
@Mapper
public interface CourseBaseContent {
    CourseBaseContent INSTANCE = Mappers.getMapper(CourseBaseContent.class);

    @Mapping(source = "id",target = "courseBaseId")
    CourseBaseDTO entity2dto(CourseBase courseBase);

    List<CourseBaseDTO> entity2dtos(List<CourseBase> courseBase);
}
